#!/bin/bash

string_1='                  '
string_2='---------------------------'
green='\e[32m'
red='\e[31m'
defult='\e[39m'
bold='\e[1m'

if [ -z "$1" ];then
    echo -e "\n$red usage:\n$string_1 [script] [ip address]"
    exit
fi

ping -c5 -i0.5 -W2 "$1" &>/dev/null
if [ $? -eq 0 ];then
    echo -e "\n$green $1 is up!\n"
else
    echo -e "\n$red $1 is down!\n"
fi